import { CommonEntity } from '../../../../common/entities/common.entity';
import { Column, Entity, Index, OneToMany } from 'typeorm';
import { DictItem } from './dict-item.entity';

@Entity({
  name: 'sys_dict_type',
  comment: '系统字典类型',
})
export class DictType extends CommonEntity {
  @Column({ type: 'varchar', length: 50, comment: '字典名称' })
  name: string;

  @Column({ type: 'varchar', length: 50, comment: '字典类型' })
  @Index('idx_code')
  code: string;

  @Column({ type: 'varchar', nullable: true, comment: '备注' })
  remark: string;

  @OneToMany(() => DictItem, (items) => items.type)
  items?: DictItem[];
}
